<template>
  <!-- 平台版本维护 -->
  <div class="video-list-wrap">
    <!-- 查询条件 -->
    <el-row type="flex" justify="space-between">
      <div class="more-btns">
        <el-button type="primary" @click="editDetail({})">新增</el-button>
      </div>
    </el-row>
    <!-- 数据列表 -->
    <el-table
      v-loading="loading"
      ref="platVersionTableList"
      :data="tableData"
      style="width: 100%">
      <el-table-column label="序号" type="index" prop="id"  width="100"></el-table-column>
      <el-table-column label="版本名称" prop="name"></el-table-column>
      <el-table-column label="版本号" prop="version"></el-table-column>
      <el-table-column label="发布人" prop="createUser"></el-table-column>
      <el-table-column label="发布时间" prop="createTime"></el-table-column>
      <el-table-column label="内容" prop="content"></el-table-column>
      <el-table-column label="备注" prop="remarks"></el-table-column>
    </el-table>

    <!-- 编辑 -->
    <el-dialog
      :close-on-click-modal="false"
      :title="editTitle"
      width="600px"
      top='15vh'
      v-if="dialogEditInfo"
      :visible.sync="dialogEditInfo"
      @close="closeEditInfo"
      v-dialogDrag>
      <app-v-info :platVersionInfo="editPlatVersionInfo" :ucOrgList="ucOrgList" :closeFun="closeEditInfo"></app-v-info>
    </el-dialog>
  </div>
</template>
<style>
  .demo-table-expand {
    font-size: 0;
  }
  .demo-table-expand label {
    width: 100px;
    color: #99a9bf;
  }
  .demo-table-expand .el-form-item {
    margin-right: 0;
    margin-bottom: 0;
    width: 100%;
  }
</style>
<script>
  import { getUcOrgList} from '@/api/org'
  import { getPlatApplyVersion } from '@/api/sysConfig'
  import appVInfo from '../Dialog/appVInfo'
  export default {
    name: 'PlatVersionList',
    // 引入子组件
    components: {
      appVInfo
    },
    data() {
      return {
        // 平台名称选项
        ucOrgList: [],
        editTitle: "新增",
        dialogEditInfo: false,
        pageLoading: false,
        loading: false,
        // 列表数据
        tableData: [],
      }
    },
    created() {//入口
      let that = this
      // 获取业主单位信息
      getUcOrgList({
      }).then(res => {
        if(res.status = 200) {
          that.ucOrgList = res.data.concat()
          that.ucOrgList.unshift({
            nodes: [],
            name: '所有单位',
            id: 0
          })
        }
      })
      // 加载列表
      that.getTableData()
    },
    methods: {
      // 获取列表数据
      getTableData(pageIndex, pageSize) {
        let that = this
        that.loading = true
        if (pageIndex) {
          that.currentPage = pageIndex
        }
        if (pageSize) {
          that.pageSize = pageSize
        }
        let parames = {
          code: 35
        }
        // 获取列表信息
        getPlatApplyVersion(parames).then(res => {
          that.tableData = res.data
          that.loading = false
        })
      },
      search() {
        this.getTableData(1)
      },

      // 编辑
      editDetail(row) {
        let that = this
        if(row) {
          that.editPlatVersionInfo = row
          that.dialogEditInfo = true
        }
      },
      // 关闭编辑弹框
      closeEditInfo(flag) {
        let that = this
        that.dialogEditInfo = false
        if(flag) {
          that.search()
        }
      },
    }

  }
</script>
